<?php
	$css_list[0]['url'] = './tpl/css/article.css';
?>
<!--{template inc/header_n}-->

<div class="main_warp">
    <div class="inventory">
        <!--{template inc/list/list_menu}-->

        <div class="i_righter">
            <p>
                当前位置：<a href="/list.php?action=plan&op=show&id={$pl['id']}">{$pl['tip']}[<?php echo date('Y-m-d', $pl['dateline']); ?>{if $pl['ampm']}下午{else}中午{/if}]</a>
                > {$item['name']}[{if $item['flag']}<span style="color:blue;">恭喜已全部完成！</span>{else}未完成{/if}]
            </p>
            
            <div style="margin-top:10px;">
                <table class="table_list" width="100%" cellspacing="1" border="0">
                    <?php $flag = false; ?>
                    {loop $item['items'][$pl['ampm']] $k $v}
                    <tr style="background-color:{$v['bgcolor']};">
                        <td width="500">{$v['name']}[{$v['sjtip']}]</td>
                        {if isset($item['data'][$k])}
                        <td><?php echo date('Y-m-d H:i:s', $item['data'][$k]['dateline']);?></td>
                        <td>已完成</td>
                        <td>-</td>
                        {else}
                        <td>-</td>
                        <td>未完成</td>
                        <td>
                        {if !$flag}
                        <input type="button" style="padding:2px 6px;" class="green_button" value="完成" onclick="docomp({$k}, this)"/>
                        <?php $flag = true; ?>
                        {else}
                        -
                        {/if}
                        </td>
                        {/if}
                    </tr>
                    {/loop}
                </table>
            </div>
        </div>
        <br class="g_clear" />
</div>
<!--{template inc/footer}-->
<script type="text/javascript">
function bindshop() {
    var ids = $('#ordersel').val();
    if(ids == 0) {
        alert('请选择订单');
        return;
    }
    
    $.post('/list.php?action=plan', {ids : ids, dobindshop:1, itemid : {$item['item_id']}}, function(s){
        if(s == '1') {
            location.reload();
        } else {
            alert('绑定失败，请重试');
        }
    });
}

function docomp(itemid, obj) {
    $.post('/list.php?action=plan', {docompact : 1, itemid : itemid, id : {$item['item_id']}, ampm : {$pl['ampm']}}, function(s){
        if('1' == s) {
            location.reload();
        } else {
            alert('操作失败，请重试');
        }
    });
}
</script>